/*
 * NextSQL.java
 *
 * Created on 30/05/2011, 16:01:52
 */
package br.com.nextsql;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.util.Properties;

import javax.swing.*;

public class NextSQL extends javax.swing.JFrame {
    private Properties lingua;
    private int janelasAbertas = 0;
    private String janelasNomes[] = new String[1];
    private Properties principal;

    /** Creates new form NextSQL */
    public NextSQL() {
        GlobalConf.verificarArquivos();
        initComponents();
        if (getClass().getResource("/br/com/nextsql/resources/images/16_ico.png") != null) {
            ImageIcon icone = new ImageIcon(getClass().getResource("/br/com/nextsql/resources/images/16_ico.png"));
            setIconImage(icone.getImage());
        }
        traducao();
        listarConexao();
    }

    public void traducao() {
        lingua = GlobalConf.lerLingua();
        mnAjuda.setText(lingua.getProperty("ajuda"));
        mnAjudaSobre.setText(lingua.getProperty("sobre"));
        mnArquivo.setText(lingua.getProperty("arquivo"));
        mnArquivoConectarEm.setText(lingua.getProperty("conectarEm"));
        mnArquivoGerenciar.setText(lingua.getProperty("gerenciarConexoes"));
        mnArquivoSair.setText(lingua.getProperty("sair"));
        mnEditar.setText(lingua.getProperty("editar"));
        mnEditarPreferencias.setText(lingua.getProperty("preferencias"));
        mnJanela.setText(lingua.getProperty("janela"));
        mnJanelaOrganizar.setText(lingua.getProperty("organizar"));
        mnJanelaOrganizarCascata.setText(lingua.getProperty("cascata"));
        btConectarEm.setToolTipText(lingua.getProperty("conectarEm"));
        btGerenciarConexoes.setToolTipText(lingua.getProperty("gerenciarConexoes"));
    }

    public void listarConexao() {
        principal = GlobalConf.lerPropriedades();
        File dir = new File(principal.getProperty("file.conexoesDir"));
        FilenameFilter fileType = new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".con");
            }
        };
        String[] dirFilhos = dir.list(fileType);
        if (dirFilhos != null && dirFilhos.length != 0) {
            mnArquivoConectarEm.setEnabled(true);
            btConectarEm.setEnabled(true);
            mnArquivoConectarEm.removeAll();
            popConexoes.removeAll();
            for (int i = 0; i < dirFilhos.length; i++) {
                final Properties prop = new Properties();
                try {
                    FileInputStream fis = new FileInputStream(principal.getProperty("file.conexoesDir") + dirFilhos[i]);
                    prop.load(fis);
                    String s[] = prop.getProperty("Tipo").split("\\."); // Nome do arquivo separando o . (Ponto)

                    javax.swing.JMenuItem mnConexoes = new javax.swing.JMenuItem();
                    if (getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png") != null) {
                        mnConexoes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png"))); // NOI18N
                    }
                    mnConexoes.setText(prop.getProperty("Nome"));
                    mnConexoes.addActionListener(new java.awt.event.ActionListener() {

                        @Override
                        public void actionPerformed(java.awt.event.ActionEvent evt) {
                            abrirMDIComandoSQL(prop);
                        }
                    });
                    javax.swing.JMenuItem mnConexoes2 = new javax.swing.JMenuItem();
                    if (getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png") != null) {
                        mnConexoes2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png"))); // NOI18N
                    }
                    mnConexoes2.setText(prop.getProperty("Nome"));
                    mnConexoes2.addActionListener(new java.awt.event.ActionListener() {

                        @Override
                        public void actionPerformed(java.awt.event.ActionEvent evt) {
                            abrirMDIComandoSQL(prop);
                        }
                    });
                    mnArquivoConectarEm.add(mnConexoes);
                    popConexoes.add(mnConexoes2);
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(rootPane, ex);
                }
            }
        } else {
            mnArquivoConectarEm.setEnabled(false);
            btConectarEm.setEnabled(false);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        popConexoes = new javax.swing.JPopupMenu();
        Ferramentas = new javax.swing.JToolBar();
        btGerenciarConexoes = new javax.swing.JButton();
        btConectarEm = new javax.swing.JButton();
        btExecutarQuery = new javax.swing.JButton();
        desktopPane = new javax.swing.JDesktopPane();
        Menu = new javax.swing.JMenuBar();
        mnArquivo = new javax.swing.JMenu();
        mnArquivoGerenciar = new javax.swing.JMenuItem();
        mnArquivoConectarEm = new javax.swing.JMenu();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        mnArquivoSair = new javax.swing.JMenuItem();
        mnEditar = new javax.swing.JMenu();
        mnEditarCopiar = new javax.swing.JMenuItem();
        mnEditarRecortar = new javax.swing.JMenuItem();
        mnEditarColar = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mnEditarLocalizar = new javax.swing.JMenuItem();
        mnEditarSubstituir = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        mnEditarPreferencias = new javax.swing.JMenuItem();
        mnJanela = new javax.swing.JMenu();
        mnJanelaOrganizar = new javax.swing.JMenu();
        mnJanelaOrganizarCascata = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        mnAjuda = new javax.swing.JMenu();
        mnAjudaSobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("NextSQL Administrator");
        setMinimumSize(new java.awt.Dimension(640, 480));

        Ferramentas.setFloatable(false);
        Ferramentas.setRollover(true);

        btGerenciarConexoes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/server_edit.png"))); // NOI18N
        btGerenciarConexoes.setToolTipText("Gerenciar conexões");
        btGerenciarConexoes.setFocusable(false);
        btGerenciarConexoes.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btGerenciarConexoes.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btGerenciarConexoes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btGerenciarConexoesActionPerformed(evt);
            }
        });
        Ferramentas.add(btGerenciarConexoes);

        btConectarEm.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/server_go.png"))); // NOI18N
        btConectarEm.setToolTipText("Conectar em:");
        btConectarEm.setFocusable(false);
        btConectarEm.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btConectarEm.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btConectarEm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btConectarEmActionPerformed(evt);
            }
        });
        Ferramentas.add(btConectarEm);

        btExecutarQuery.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/arrow-right-double.png"))); // NOI18N
        btExecutarQuery.setToolTipText("Executar Query...");
        btExecutarQuery.setFocusable(false);
        btExecutarQuery.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btExecutarQuery.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btExecutarQuery.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExecutarQueryActionPerformed(evt);
            }
        });
        Ferramentas.add(btExecutarQuery);

        desktopPane.setBackground(java.awt.SystemColor.controlShadow);
        desktopPane.setAlignmentX(0.0F);
        desktopPane.setAlignmentY(0.0F);
        desktopPane.setAutoscrolls(true);
        desktopPane.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        mnArquivo.setMnemonic('A');
        mnArquivo.setText("Arquivo");

        mnArquivoGerenciar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        mnArquivoGerenciar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/server_edit.png"))); // NOI18N
        mnArquivoGerenciar.setMnemonic('N');
        mnArquivoGerenciar.setText("Gerenciar conexões");
        mnArquivoGerenciar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnArquivoGerenciarActionPerformed(evt);
            }
        });
        mnArquivo.add(mnArquivoGerenciar);

        mnArquivoConectarEm.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/server_go.png"))); // NOI18N
        mnArquivoConectarEm.setMnemonic('C');
        mnArquivoConectarEm.setText("Conectar em:");
        mnArquivo.add(mnArquivoConectarEm);
        mnArquivo.add(jSeparator3);

        mnArquivoSair.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        mnArquivoSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/cross.png"))); // NOI18N
        mnArquivoSair.setMnemonic('S');
        mnArquivoSair.setText("Sair");
        mnArquivoSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnArquivoSairActionPerformed(evt);
            }
        });
        mnArquivo.add(mnArquivoSair);

        Menu.add(mnArquivo);

        mnEditar.setMnemonic('E');
        mnEditar.setText("Editar");

        mnEditarCopiar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        mnEditarCopiar.setText("Copiar");
        mnEditar.add(mnEditarCopiar);

        mnEditarRecortar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        mnEditarRecortar.setText("Recortar");
        mnEditar.add(mnEditarRecortar);

        mnEditarColar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        mnEditarColar.setText("Colar");
        mnEditar.add(mnEditarColar);
        mnEditar.add(jSeparator1);

        mnEditarLocalizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK));
        mnEditarLocalizar.setText("Localizar");
        mnEditar.add(mnEditarLocalizar);

        mnEditarSubstituir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        mnEditarSubstituir.setText("Substituir");
        mnEditar.add(mnEditarSubstituir);
        mnEditar.add(jSeparator2);

        mnEditarPreferencias.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK));
        mnEditarPreferencias.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/preferences.png"))); // NOI18N
        mnEditarPreferencias.setMnemonic('P');
        mnEditarPreferencias.setText("Preferências");
        mnEditarPreferencias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnEditarPreferenciasActionPerformed(evt);
            }
        });
        mnEditar.add(mnEditarPreferencias);

        Menu.add(mnEditar);

        mnJanela.setMnemonic('j');
        mnJanela.setText("Janela");
        mnJanela.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                mnJanelaMouseEntered(evt);
            }
        });

        mnJanelaOrganizar.setMnemonic('O');
        mnJanelaOrganizar.setText("Organizar");

        mnJanelaOrganizarCascata.setMnemonic('C');
        mnJanelaOrganizarCascata.setText("Cascata");
        mnJanelaOrganizarCascata.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnJanelaOrganizarCascataActionPerformed(evt);
            }
        });
        mnJanelaOrganizar.add(mnJanelaOrganizarCascata);

        mnJanela.add(mnJanelaOrganizar);
        mnJanela.add(jSeparator4);

        Menu.add(mnJanela);

        mnAjuda.setMnemonic('u');
        mnAjuda.setText("Ajuda");

        mnAjudaSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/information.png"))); // NOI18N
        mnAjudaSobre.setMnemonic('S');
        mnAjudaSobre.setText("Sobre");
        mnAjudaSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnAjudaSobreActionPerformed(evt);
            }
        });
        mnAjuda.add(mnAjudaSobre);

        Menu.add(mnAjuda);

        setJMenuBar(Menu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Ferramentas, javax.swing.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(Ferramentas, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-640)/2, (screenSize.height-480)/2, 640, 480);
    }// </editor-fold>//GEN-END:initComponents

    private void mnArquivoSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnArquivoSairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_mnArquivoSairActionPerformed

    private void mnAjudaSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnAjudaSobreActionPerformed
        Sobre abrir = new Sobre(this, rootPaneCheckingEnabled);
        if (getClass().getResource("/br/com/nextsql/resources/icons/information.png") != null) {
            ImageIcon icone = new ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/information.png"));
            abrir.setIconImage(icone.getImage());
        }
        abrir.setVisible(true);
    }//GEN-LAST:event_mnAjudaSobreActionPerformed

    private void mnArquivoGerenciarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnArquivoGerenciarActionPerformed
        GerenciarConexoes abrir = new GerenciarConexoes(this, rootPaneCheckingEnabled);
        if (getClass().getResource("/br/com/nextsql/resources/icons/server_edit.png") != null) {
            ImageIcon icone = new ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/server_edit.png"));
            abrir.setIconImage(icone.getImage());
        }
        abrir.setVisible(true);
        if (abrir.isRetorno()){
            if(abrir.isAbrirconexao()){
                Properties a = abrir.getPropriedades();
                System.out.println(a.getProperty("Nome"));
                abrirMDIComandoSQL(abrir.getPropriedades());
            }
            System.gc();
            listarConexao();
            
        }
    }//GEN-LAST:event_mnArquivoGerenciarActionPerformed
    private void mnJanelaOrganizarCascataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnJanelaOrganizarCascataActionPerformed
        JInternalFrame frames[] = desktopPane.getAllFrames();
        if (frames.length > 0) {
            cascade(frames, desktopPane.getBounds());
        }
    }//GEN-LAST:event_mnJanelaOrganizarCascataActionPerformed
    private void mnJanelaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mnJanelaMouseEntered
        JInternalFrame frames[] = desktopPane.getAllFrames();
        boolean tiraMenu = true;
        Component menujanela[] = mnJanela.getMenuComponents();
        String t1, t2;
        for (int i = 2; i < menujanela.length; i++) {
            for (int j = 0; j < frames.length; j++) {
                t1 = frames[j].getTitle();
                t2 = ((JMenuItem) menujanela[i]).getText();
                if (t1.equals(t2)) {
                    tiraMenu = false;
                    break;
                }
            }
            if (tiraMenu) {
                mnJanela.remove(menujanela[i]);
            }
            tiraMenu = true;
        }
    }//GEN-LAST:event_mnJanelaMouseEntered

    private void btGerenciarConexoesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btGerenciarConexoesActionPerformed
        mnArquivoGerenciar.doClick();
    }//GEN-LAST:event_btGerenciarConexoesActionPerformed

    private void mnEditarPreferenciasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnEditarPreferenciasActionPerformed
        Preferencias abrir = new Preferencias(this, rootPaneCheckingEnabled);
        if (getClass().getResource("/br/com/nextsql/resources/icons/preferences.png") != null) {
            ImageIcon icone = new ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/preferences.png"));
            abrir.setIconImage(icone.getImage());
        }
        abrir.setVisible(true);
        if (abrir.isRetorno()) {
            traducao();
        }
    }//GEN-LAST:event_mnEditarPreferenciasActionPerformed

    private void btConectarEmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btConectarEmActionPerformed
        popConexoes.show(btConectarEm, btConectarEm.getX() - btConectarEm.getHeight(), btConectarEm.getY() + btConectarEm.getWidth());
    }//GEN-LAST:event_btConectarEmActionPerformed

    private void btExecutarQueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExecutarQueryActionPerformed
        System.out.println(desktopPane.getSelectedFrame().getTitle());
    }//GEN-LAST:event_btExecutarQueryActionPerformed
    private static void cascade(JInternalFrame[] frames, Rectangle dBounds) {
        Dimension d, cd;
        int width = 550;
        int height = 400;
        int offset = 0;
        for (int i = 0; i < frames.length; i++) {
            if (i == 0) {
                frames[i].setBounds(0, 0, width, height);
            } else {
                frames[i].setBounds(dBounds.x + offset, dBounds.y + offset - 31, width, height);
            }
            d = frames[i].getSize();
            cd = frames[i].getContentPane().getSize();
            offset += Math.max(d.width - cd.width, d.height - cd.height);
            if (offset > cd.height - 20) {
                offset = offset / cd.height;
            }
        }
    }

    private boolean janelaNomeExiste(String nome) {
        boolean existe = false;
        for (String n : janelasNomes) {
            if (nome.equals(n)) {
                existe = true;
                break;
            }
        }
        return existe;
    }

    private void abrirMDIComandoSQL(Properties propriedades) {
        String nome = propriedades.getProperty("Nome");
        int y = 2;
        while (janelasAbertas > 0 && janelaNomeExiste(nome)) {
            nome = propriedades.getProperty("Nome") + " (" + y + ")";
            y++;
        }
        String temp[] = new String[janelasNomes.length + 1];
        for (int i = 0; i < janelasNomes.length; i++) {
            temp[i] = janelasNomes[i];
        }
        janelasNomes = temp;
        janelasNomes[janelasNomes.length - 1] = nome;
        ComandoSQL janela = new ComandoSQL();
        janela.setPropriedades(propriedades);
        janela.setSize(desktopPane.getSize());
        janela.setLocation(0, 0);
        janela.setName(String.valueOf(janelasAbertas));
        String s[] = propriedades.getProperty("Tipo").split("\\.");
        if (getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png") != null) {
            ImageIcon icone = new ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png"));
            janela.setFrameIcon(icone);
        }
        desktopPane.add(janela);
        try {
            janela.setMaximum(true);
        } catch (Exception ex){}
        janela.setTitle(nome);
        JMenuItem newJanelaMenu = new JMenuItem(nome);
        newJanelaMenu.setMnemonic(janelasAbertas);
        if (getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png") != null) {
            newJanelaMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/nextsql/resources/icons/" + s[0] + ".png"))); // NOI18N
        }
        mnJanela.add(newJanelaMenu);
        newJanelaMenu.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                JMenuItem item = (JMenuItem) ae.getSource();
                JInternalFrame frames[] = desktopPane.getAllFrames();
                for (int i = 0; i < frames.length; i++) {
                    if (Integer.parseInt(frames[i].getName()) == item.getMnemonic()) {
                        try {
                            frames[i].setSelected(true);
                        } catch (PropertyVetoException ex){}
                        break;
                    }
                }
            }
        });
        janela.show();
        janelasAbertas++;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
        String lookAndFeel = UIManager.getSystemLookAndFeelClassName();
        UIManager.setLookAndFeel(lookAndFeel);
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new NextSQL().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToolBar Ferramentas;
    private javax.swing.JMenuBar Menu;
    private javax.swing.JButton btConectarEm;
    private javax.swing.JButton btExecutarQuery;
    private javax.swing.JButton btGerenciarConexoes;
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JMenu mnAjuda;
    private javax.swing.JMenuItem mnAjudaSobre;
    private javax.swing.JMenu mnArquivo;
    private javax.swing.JMenu mnArquivoConectarEm;
    private javax.swing.JMenuItem mnArquivoGerenciar;
    private javax.swing.JMenuItem mnArquivoSair;
    private javax.swing.JMenu mnEditar;
    private javax.swing.JMenuItem mnEditarColar;
    private javax.swing.JMenuItem mnEditarCopiar;
    private javax.swing.JMenuItem mnEditarLocalizar;
    private javax.swing.JMenuItem mnEditarPreferencias;
    private javax.swing.JMenuItem mnEditarRecortar;
    private javax.swing.JMenuItem mnEditarSubstituir;
    private javax.swing.JMenu mnJanela;
    private javax.swing.JMenu mnJanelaOrganizar;
    private javax.swing.JMenuItem mnJanelaOrganizarCascata;
    private javax.swing.JPopupMenu popConexoes;
    // End of variables declaration//GEN-END:variables
}
